package com.sleepcamel.rest.domain.method.parameter;

import java.util.Set;

import com.sleepcamel.rest.domain.IEncodable;

public class RESTMethodParameter extends MethodParameter implements IEncodable {

	private RESTMethodParameterType restParameterType;
	private boolean encodable = false;
	
	public RESTMethodParameter() {
		restParameterType = new RESTMethodParameterType(RESTMethodParameterTypeName.PathParam);
	}

	public RESTMethodParameterType getRestParameterType() {
		return restParameterType;
	}

	public void setRestParameterType(RESTMethodParameterType restParameterType) {
		support.firePropertyChange("restParameterType", this.restParameterType, this.restParameterType = restParameterType);
	}

	@Override
	public boolean isEncodable() {
		return encodable;
	}

	public void setEncodable(boolean encodable) {
		this.encodable = encodable;
	}

	@Override
	public Set<String> getInterfaceImports() {
		super.getInterfaceImports();
		
		if ( encodable )
			interfaceImports.add("javax.ws.rs.Encoded");
		
		interfaceImports.add(restParameterType.getImport());
		return interfaceImports;
	}
	
}
